package Problem;

import java.util.Scanner;

//
// Created by ✎﹏ℳ๓独赏☆独醉 on 2024/1/26.
// 
public class 求最大间隙 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int dis = 0;
        int[] arr = new int[num];
        for (int i = 0; i < num; i++) {
            arr[i] = scan.nextInt();
        }
        for (int i = 0; i < num-1; i++) {
            if(dis < arr[i+1] - arr[i]){
                dis = arr[i+1 ] - arr[i];
            }
        }
        System.out.println(dis);
    }
}
